package com.hotline.communication.service.impl;

import com.hotline.communication.mapper.CallLogMapper;
import com.hotline.communication.dto.CallLogDTO;
import com.hotline.communication.service.CallLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

@Service
@Slf4j
public class CallLogServiceImpl implements CallLogService {

    @Resource
    private CallLogMapper callLogMapper;

    @Override
    public void insert(CallLogDTO callLogDTO) {
        try {
            log.info("TX_LOG[]call_log[]呼叫日志[]新增呼叫日志[]callLogDTO:{}",callLogDTO);
            callLogMapper.insert(callLogDTO);
        }catch (Exception e){
            log.error("新增呼叫日志失败, callLogDTO={}, cause:{}", callLogDTO,e.getMessage());
        }
    }

    @Override
    public void update(CallLogDTO callLogDTO) {
        try {
            log.info("TX_LOG[]call_log[]呼叫日志[]更新呼叫日志[]callLogDTO:{}",callLogDTO);
            callLogMapper.update(callLogDTO);
        }catch (Exception e){
            log.error("更新呼叫日志失败, callLogDTO={}, cause:{}", callLogDTO,e.getMessage());
        }
    }

    @Override
    public void update2(CallLogDTO callLogDTO) {
        try {
            log.info("TX_LOG[]call_log[]呼叫日志[]更新呼叫日志[]callLogDTO:{}",callLogDTO);
            callLogMapper.update2(callLogDTO);
        }catch (Exception e){
            log.error("更新呼叫日志失败, callLogDTO={}, cause:{}", callLogDTO,e.getMessage());
        }
    }


    @Override
    public CallLogDTO selectById(String callId) {
        CallLogDTO callLogDTO = callLogMapper.selectById(callId);
        return callLogDTO;
    }

    @Override
    public List<CallLogDTO> selectList(CallLogDTO callLogDTO) {

        List<CallLogDTO> list = callLogMapper.selectList(callLogDTO);
        return list;
    }
}
